<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加发票</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/index.css">
    <style>
        #bu1 {
            position: absolute;
            width: 200px;
            height: 30px;
            left: 470px;
            top: 560px;
            background-color: #01AAED;
        }
    </style>
</head>
<body>
<form action="" method="post" enctype=" multipart/form-data" name="biaodan" style="padding: 15px;" id="f1">

    <label for="address" style="position: absolute;left:400px;top:63px;}">邮寄地址:</label>
    <input type="text" name="address" id="address" style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="companyId" style="position: absolute;left:390px;top:125px;}">物流企业id:</label>
    <input type="text" name="companyId" id="companyId"
           style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="driverId" style="position: absolute;left:410px;top:185px;}">司机id:</label>
    <input type="text" name="driverId" id="driverId" style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="excludingTaxMoney" style="position: absolute;left:380px;top:240px;}">不含税金额:</label>
    <input type="text" name="excludingTaxMoney" id="excludingTaxMoney"
           style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="invoiceNum" style="position: absolute;left:380px;top:300px;}">发票申请号:</label>
    <input type="text" name="invoiceNum" id="invoiceNum"
           style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="state" style="position: absolute;left:420px;top:365px;}">状态:</label>
    <input type="text" name="state" id="state" style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="taxRate" style="position: absolute;left:420px;top:420px;}">税率:</label>
    <input type="text" name="taxRate" id="taxRate" style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <label for="taxpayer" style="position: absolute;left:410px;top:480px;}">纳税人:</label>
    <input type="text" name="taxpayer" id="taxpayer" style="width:250px;height:30px;margin-top:25px;margin-left:450px;">
    <input type="button" value="提交" name="tijiao" id="bu1" style="position: absolute " onclick="bu()">
</form>
</body>
<script src="lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>

<script>
    function bu() {
        var list = {
            "address": document.getElementById("address").value,
            //"agreeTime": 0,
            "companyId": document.getElementById("companyId").value,
            //"createTime":  0,
            "driverId": document.getElementById("driverId").value,
            "excludingTaxMoney": document.getElementById("excludingTaxMoney").value,
            //"id":  0,
            "invoiceNum": document.getElementById("invoiceNum").value,
            //"refuseTime": 0,
            "state": document.getElementById("state").value,
            "taxRate": document.getElementById("taxRate").value,
            "taxpayer": document.getElementById("taxpayer").value
        };
        var lists = JSON.stringify(list);

        $.ajax({
            type: 'Post',
            url: 'http://localhost:5500/t-invoice/addInvoice',
            data: lists,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (result) {
                console.log(result);
                alert("添加成功");

            }, error: function (e) {//响应不成功时返回的函数
                console.log(e, 'error');
                alert("错误");
            }
        });
    };
</script>
</html>